//
//  UISegmentedControl+Extension.m
//  JKWDTeacher
//
//  Created by 学大教育 on 2022/2/16.
//

#import "UISegmentedControl+Extension.h"
#import "NSObject+Extension.h"
@implementation UISegmentedControl (Extension)
+ (void)load
{
    [self swizzleInstanceMethod:@selector(layoutSubviews) with:@selector(xy_layoutSubviews)];
}
- (CGFloat)radius
{
    return [objc_getAssociatedObject(self, _cmd) doubleValue];
}
- (void)setRadius:(CGFloat)radius
{
    objc_setAssociatedObject(self, @selector(radius), @(radius), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    [self setNeedsLayout];
    [self layoutIfNeeded];
}

- (void)xy_layoutSubviews
{
    [self xy_layoutSubviews];
    self.layer.cornerRadius = self.radius;
}
@end
